package org.ysu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.ysu.pojo.Poor;
import org.ysu.service.PoorService;
import org.ysu.mapper.PoorMapper;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import javax.annotation.Resource;
import java.util.List;

/**
* @author libaoyu
* @description 针对表【poor】的数据库操作Service实现
* @createDate 2024-06-17 14:59:45
*/
@Service
public class PoorServiceImpl extends ServiceImpl<PoorMapper, Poor>
    implements PoorService{

    @Resource
    private PoorMapper poorMapper;

    @Override
    public List<Poor> getListsByFid(Integer id) {
        //根据id查询poor中f_id相同的列表
        return poorMapper.getListsByFid(id);
    }

    /**
     * 查询所有户主
     * @return
     */
    @Override
    public List<Poor> getAllHead() {
        LambdaQueryWrapper<Poor> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Poor::getIshead, 'Y');
        List<Poor> clues = poorMapper.selectList(wrapper);
        return clues;
    }
    /**
     * 根据id查人
     * @param pId
     * @return
     */
    @Override
    public Poor getPoor(Integer pId) {
        return  poorMapper.getPoor(pId);
    }
}




